﻿<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
         xmlns:db="http://www.springframework.net/database">

  <!-- Referenced by main application context configuration file -->
  <description>
    The Northwind object definitions for the Data Access Objects.
  </description>

  <!-- Property placeholder configurer for database settings -->
  <object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
    <property name="ConfigSections" value="databaseSettings"/>
  </object>

  <!-- Database Configuration -->
  <!--<db:provider id="DbProvider"
                   provider="SQLite-1.0.65"
                   connectionString="Data Source=|DataDirectory|Northwind.db;Version=3;FailIfMissing=True;"/>-->

  <!--<db:provider id="DbProvider"
                   provider="SqlServer-4.0"
                   connectionString="Integrated Security=true; Data Source=${db.datasource};Database=${db.database};"/>-->
  <!--<db:provider id="DbProvider"
                   provider="SqlServer-4.0"
                   connectionString="Integrated Security=false; Data Source=(local);Integrated Security=true;Database=FastSpring20;User ID=sa;Password=12345;"/>-->
  <db:provider id="DbProvider"
                   provider="SqlServer-4.0"
                   connectionString="Server=${db.datasource};database=${db.database};user id=${db.user};password=${db.password};Trusted_connection=false;"/>


  <!-- NHibernate Configuration -->
  <object id="NHibernateSessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate32">
    <property name="DbProvider" ref="DbProvider"/>
    <property name="MappingAssemblies">
      <list>
        <value>OpenSda.Agilcont.Common.Data.NhContexts</value>
      </list>
    </property>
    <property name="HibernateProperties">
      <dictionary>
        <!--<entry key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
        <entry key="dialect" value="NHibernate.Dialect.SQLiteDialect"/>
        <entry key="connection.driver_class" value="NHibernate.Driver.SQLite20Driver"/>
        <entry key="use_proxy_validator" value="false" />-->
        <entry key="hibernate.connection.provider"
               value="NHibernate.Connection.DriverConnectionProvider"/>

        <entry key="dialect"
               value="NHibernate.Dialect.MsSql2005Dialect"/>

        <entry key="connection.driver_class"
               value="NHibernate.Driver.SqlClientDriver"/>

        <entry key="show_sql"
					   value="true"/>


      </dictionary>
    </property>

    <!-- provides integation with Spring's declarative transaction management features -->
    <property name="ExposeTransactionAwareSessionFactory" value="true" />

  </object>

  <!-- Transaction Management Strategy - local database transactions -->
  <object id="transactionManager"
        type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate32">

    <property name="DbProvider" ref="DbProvider"/>
    <property name="SessionFactory" ref="NHibernateSessionFactory"/>

  </object>

  <!-- Exception translation object post processor -->
  <object type="Spring.Dao.Attributes.PersistenceExceptionTranslationPostProcessor, Spring.Data"/>

  <object id="HibernateTemplate" type="Spring.Data.NHibernate.HibernateTemplate">
        <property name="SessionFactory" ref="NHibernateSessionFactory" />
        <property name="TemplateFlushMode" value="Auto" />
        <property name="CacheQueries" value="true" />
    
  </object>

  
  <!-- Data Access Objects. Coloque aquí las otras clases Datas-->

  <object id="CustomerData" type="OpenSda.Agilcont.Common.Data.NhContexts.CustomerData, OpenSda.Agilcont.Common.Data.NhContexts">
    <property name="HibernateTemplate" ref="HibernateTemplate"/>
  </object>
  <object id="EmpresaData" type="OpenSda.Agilcont.Common.Data.NhContexts.EmpresaData, OpenSda.Agilcont.Common.Data.NhContexts">
    <property name="HibernateTemplate" ref="HibernateTemplate"/>
  </object>
  <object id="UserData" type="OpenSda.Agilcont.Common.Data.NhContexts.UserData, OpenSda.Agilcont.Common.Data.NhContexts">
    <property name="HibernateTemplate" ref="HibernateTemplate"/>
  </object>
  <object id="AgenciaData" type="OpenSda.Agilcont.Common.Data.NhContexts.AgenciaData, OpenSda.Agilcont.Common.Data.NhContexts">
    <property name="HibernateTemplate" ref="HibernateTemplate"/>
  </object>
  <object id="CuentaData" type="OpenSda.Agilcont.Common.Data.NhContexts.CuentaData, OpenSda.Agilcont.Common.Data.NhContexts">
    <property name="HibernateTemplate" ref="HibernateTemplate"/>
  </object>
  <object id="CentroCostoData" type="OpenSda.Agilcont.Common.Data.NhContexts.CentroCostoData, OpenSda.Agilcont.Common.Data.NhContexts">
    <property name="HibernateTemplate" ref="HibernateTemplate"/>
  </object>
  <object id="CorrelativoEntidadData" type="OpenSda.Agilcont.Common.Data.NhContexts.CorrelativoEntidadData, OpenSda.Agilcont.Common.Data.NhContexts">
    <property name="HibernateTemplate" ref="HibernateTemplate"/>
  </object>
  <object id="DataAccessAgenciaConfigData" type="OpenSda.Agilcont.Common.Data.NhContexts.DataAccessAgenciaConfigData, OpenSda.Agilcont.Common.Data.NhContexts">
    <property name="HibernateTemplate" ref="HibernateTemplate"/>
  </object>
  <object id="ModuleAccessData" type="OpenSda.Agilcont.Common.Data.NhContexts.ModuleAccessData, OpenSda.Agilcont.Common.Data.NhContexts">
    <property name="HibernateTemplate" ref="HibernateTemplate"/>
  </object>
</objects>
